<!--
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/business/checklist/CheckList.js此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/business/checklist/CheckList.js";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'Id',
                footer: "Foots",
                cnName: '检化验',
                name: 'checklist/CheckList',
                url: "/CheckList/",
                sortName: "CheckListNo",
                foreignKey:"CheckListId"
            });
            const editFormFields = ref({"CheckListNo":"","MaterialNo":"","MaterialName":"","Step":"","BatchNo":"","GetTime":"","Result":"","Category":"","MaterialId":""});
            const editFormOptions = ref([[{"title":"化验单号","field":"CheckListNo"},
                               {"title":"物料（产品）号","field":"MaterialNo"},
                               {"dataKey":"检验项目","data":[],"title":"物料（产品）名称","field":"MaterialName","type":"select"}],
                              [{"title":"批号","field":"BatchNo"},
                               {"title":"获取时间","field":"GetTime"},
                               {"title":"工艺步骤","required":true,"field":"Step","type":"number"}],
                              [{"title":"总结果","field":"Result","type":"number"},
                               {"dataKey":"检验类别","data":[],"title":"检验类别","field":"Category","type":"select"},
                               {"title":"物料或产品Id","field":"MaterialId","disabled":true}]]);
            const searchFormFields = ref({"CheckListNo":"","MaterialNo":"","MaterialName":"","BatchNo":""});
            const searchFormOptions = ref([[{"title":"化验单号","field":"CheckListNo"},{"title":"物料（产品）号","field":"MaterialNo"},{"dataKey":"检验项目","data":[],"title":"物料（产品）名称","field":"MaterialName"},{"title":"批号","field":"BatchNo"}]]);
            const columns = ref([{field:'Id',title:'主键',type:'string',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'CheckListNo',title:'化验单号',type:'string',link:true,width:110,align:'left',sort:true},
                       {field:'MaterialNo',title:'物料（产品）号',type:'string',width:110,align:'left'},
                       {field:'MaterialName',title:'物料（产品）名称',type:'string',bind:{ key:'检验项目',data:[]},width:110,align:'left'},
                       {field:'Step',title:'工艺步骤',type:'int',width:80,require:true,align:'left'},
                       {field:'BatchNo',title:'批号',type:'string',width:110,align:'left'},
                       {field:'GetTime',title:'获取时间',type:'datetime',width:150,align:'left',sort:true},
                       {field:'Result',title:'总结果',type:'int',width:110,align:'left'},
                       {field:'DeletionFlag',title:'删除标识',type:'int',width:110,hidden:true,align:'left'},
                       {field:'Category',title:'检验类别',type:'int',bind:{ key:'检验类别',data:[]},width:80,align:'left'},
                       {field:'MaterialId',title:'物料或产品Id',type:'string',width:80,readonly:true,align:'left'}]);
            const detail = ref({
                cnName: "检化验明细",
                table: "CheckListDetailed",
                columns: [{field:'Id',title:'主键',type:'string',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'CheckListId',title:'化验单主健',type:'string',width:110,hidden:true,align:'left'},
                       {field:'Element',title:'元素',type:'string',bind:{ key:'Element_List',data:[]},width:110,edit:{type:'select'},align:'left',sort:true},
                       {field:'ElementId',title:'元素Id',type:'string',width:110,hidden:true,readonly:true,edit:{type:''},align:'left'},
                       {field:'Result',title:'结果',type:'string',width:110,edit:{type:''},align:'left'},
                       {field:'Standard',title:'标准',type:'string',width:110,edit:{type:''},align:'left'},
                       {field:'IsQualified',title:'是否合格',type:'int',width:110,edit:{type:'switch'},align:'left'}],
                sortName: "CheckListId",
                key: "Id"
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
            };
        },
    });
</script>
